<template>
  <div 
    class="gradient-card"
    :class="[`gradient-${type}`, { 'hover-effect': hoverEffect }]"
    @click="$emit('click')"
  >
    <div class="card-content">
      <slot />
    </div>
  </div>
</template>

<script setup>
/**
 * 微渐变背景圆角卡片组件
 * @description 提供统一的卡片样式，支持多种渐变类型和悬停效果
 * @param {string} type - 渐变类型：primary(默认)、success、warning、danger、info
 * @param {boolean} hoverEffect - 是否启用悬停效果
 */
defineProps({
  type: {
    type: String,
    default: 'primary',
    validator: (value) => ['primary', 'success', 'warning', 'danger', 'info'].includes(value)
  },
  hoverEffect: {
    type: Boolean,
    default: true
  }
})

defineEmits(['click'])
</script>

<style scoped>
.gradient-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.gradient-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gradient-card:hover::before {
  opacity: 1;
}

.gradient-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.gradient-success {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.gradient-warning {
  background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.gradient-danger {
  background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
}

.gradient-info {
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.hover-effect:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
}

.card-content {
  position: relative;
  z-index: 1;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .gradient-card {
    border-radius: 12px;
    padding: 16px;
  }
}
</style> 